/*
 *
 * Copyright (C) 2012 Walter Lütgenau
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package offset.nodes.client.dialog.newnode.model;

import java.util.Calendar;
import offset.nodes.client.model.ServerResponse;
import offset.nodes.client.model.ServerResponse;
import offset.nodes.client.model.UserRequest;
import offset.nodes.client.model.UserRequest;

/**
 *
 * @author Walter Lütgenau
 */
public class NewFile {
    
    /** Creates a new instance of NewFile */
    public static class Request extends UserRequest {
        private String path;
        private String contentType;
        private byte[] content; // this is not a good solution for large files. In that case separate messages should be used, that add content to a node in packages.
        private String text; // future extension: Maybe used for full text search
        private Calendar lastModified;
        boolean commit = true;
        
        public Request() {
        }
        
        public Request(String path, String contentType, byte[] content) {
            this.path = path;
            this.contentType = contentType;
            this.content = content;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getContentType() {
            return contentType;
        }

        public void setContentType(String contentType) {
            this.contentType = contentType;
        }

        public byte[] getContent() {
            return content;
        }

        public void setContent(byte[] content) {
            this.content = content;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public Calendar getLastModified() {
            return lastModified;
        }

        public void setLastModified(Calendar lastModified) {
            this.lastModified = lastModified;
        }

        public boolean isCommit() {
            return commit;
        }

        public void setCommit(boolean commit) {
            this.commit = commit;
        }
    }
    
    public static class Response extends ServerResponse {
        public static final int RESULT_CONCURRENT_MODIFICATION = 100;
        String uuid;
        
        public Response(int result) {
            super(result);
        }

        public String getUuid() {
            return uuid;
        }

        public void setUuid(String uuid) {
            this.uuid = uuid;
        }
    }
    
}
